package de.szut.tiktaktoe.model;

import de.szut.tiktaktoe.gui.Listener;

public class Model {
	@SuppressWarnings("unused")
	private Listener listen;
	private boolean player1 = true;
	
	public Model(){
		
	}
	public void newGame() {
		player1 = true;
	}
	public void checkGame(String [][] field){
		if (field[1][1] == "X" && field[1][2] == "X" && field[1][3] == "X" || field[1][1] == "O" && field[1][2] == "O" && field[1][3] == "O"){
			System.out.println("Player" + player1 + "wins");
		}
		else if (field[2][1] == "X" && field[2][2] == "X" && field[2][3] == "X" || field[2][1] == "O" && field[2][2] == "O" && field[2][3] == "O"){
			System.out.println("Player" + player1 + "wins");
		}
		else if (field[3][1] == "X" && field[3][2] == "X" && field[3][3] == "X" || field[3][1] == "O" && field[3][2] == "O" && field[3][3] == "O"){
			System.out.println("Player" + player1 + "wins");
		}
		else if (field[1][1] == "X" && field[2][2] == "X" && field[3][3] == "X" || field[1][1] == "O" && field[2][2] == "O" && field[3][3] == "O"){
			System.out.println("Player" + player1 + "wins");
		}
		else if (field[1][3] == "X" && field[2][2] == "X" && field[3][1] == "X" || field[1][3] == "O" && field[2][2] == "O" && field[3][1] == "O"){
			System.out.println("Player" + player1 + "wins");
		}
		else if (field[1][1] == "X" && field[2][1] == "X" && field[3][1] == "X" || field[1][1] == "O" && field[2][1] == "O" && field[3][1] == "O"){
			System.out.println("Player" + player1 + "wins");
		}
		else if (field[2][1] == "X" && field[2][2] == "X" && field[2][3] == "X" || field[2][1] == "O" && field[2][2] == "O" && field[2][3] == "O"){
			System.out.println("Player" + player1 + "wins");
		}
		else if (field[3][1] == "X" && field[3][2] == "X" && field[3][3] == "X" || field[3][1] == "O" && field[3][2] == "O" && field[3][3] == "O"){
			System.out.println("Player" + player1 + "wins");
		}
	}
}
